package java_thinking.unit_17._17_2_6;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

import static java_thinking.unit_17._17_2_6.Countries.names;

/**
 * @Desc:   创建一个List(用ArrayList和LinkedList都尝试一下)，然后用Countries来填充，
 *          对该列表排序并打印，然后将Collections.shuffle()方法重复的引用于该列表，并且每次都打印它，
 * @author: cww
 * @DateTime: 2019-04-14 22:23
 */

public class E01_CountryList {
    private static Random rnd = new Random(47);

    public static void main(String[] args) {
        List<String> l = new ArrayList<>(names(8));
        Collections.sort(l);
        System.out.println("sorted : "+l);
        for (int i =1; i < 5; i++) {
            Collections.shuffle(l,rnd);
            System.out.println("shuffled (" + i + "): "+l);
        }
    }
}
